<div class="row row-cards row-deck">
  <div class="col-12">
    <div class="card">
      <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
        <thead>
          <tr>
            <th class="text-center w-1"><i class="icon-people"></i></th>
            <th>会员等级名字</th>
            <th>是否使用</th>
            <th>折扣率</th>
            <th>售价</th>
            <th class="text-center">
              <a href="<%= new_admin_membership_path %>">新增会员等级</a>
            </th>
          </tr>
        </thead>
        <tbody>
          <% @memberships.each do |membership| %>
          <tr>
            <td class="text-center">
              <div class="avatar d-block" style="background-image: url(<%= membership.avatar.url %>)">
                <span class="avatar-status bg-green"></span>
              </div>
            </td>
            <td>
              <div><%= membership.name %></div>
              <div class="small text-muted">
                <%= formattime(membership.created_at, unit: "day") %>
              </div>
            </td>
            <td>
              <div>
                <%= membership.published ? "是" : "否" %>
              </div>
            </td>
            <td>
              <div>
                <%= membership.discount %>%
              </div>
            </td>
            <td>
              <div>
                <%= membership.price %>
              </div>
            </td>
            <td class="text-center">
              <div class="item-action dropdown">
                <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
                <div class="dropdown-menu dropdown-menu-right">
                  <a href="<%= edit_admin_membership_path(membership) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 修改 </a>
                  <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-edit-2"></i> 删除 </a>
                </div>
              </div>
            </td>
          </tr>
          <% end %>
        </tbody>
      </table>
      <div class="card-footer">
        <%= paginate @memberships %>
      </div>
    </div>
  </div>
</div>